﻿using infoMECHANICA.NHibernateORM.TestMappings;
using NHibernate.Criterion;

namespace infoMECHANICA.NHibernateORM.ExampleProgram
{
    /// <summary>
    /// See http://www.codeplex.com/nhcb/Wiki/View.aspx?title=SIMPLE_QUERIES&referringTitle=Home for details
    /// </summary>
    public class Example1 : IExample
    {
        #region IExample Members

        public string Title
        {
            get
            {
                return "Example 1 - Simple queries";
            }
        }

        public DetachedCriteria ComposeCriteria()
        {
            //Load all employees whose name is equal to 'Smith' or 'Doe' and salary is greater than '700'
            EmployeeRec employeeRec = new EmployeeRec();
            employeeRec.LastName.SetEq("Smith").Or.SetEq("Doe");
            employeeRec.Salary.SetGt(700);

            return employeeRec.BuildCriteria();
        }

        #endregion
    }
}
